package com.kexin.coupon.entity;

import java.io.Serializable;
import java.time.LocalDateTime;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="Coupon对象", description="卡券信息表")
public class Coupon implements Serializable {

	private static final long serialVersionUID = 1L;

	@ApiModelProperty(value = "卡券id")
	@TableId(value = "id", type = IdType.AUTO)
	private Integer id;

	@JsonIgnore
	//@ApiModelProperty(value = "卡券渠道类型 (CP001 中石油)")
	@TableField
	private String channelType;

	@JsonIgnore
	//@ApiModelProperty(value = "卡券编码")
	@TableField
	private String couponCode;

	@ApiModelProperty(value = "卡券名称")
	@TableField
	private String couponName;

	@ApiModelProperty(value = "卡券描述")
	@TableField
	private String detail;

	@ApiModelProperty(value = "卡券图片地址")
	@TableField
	private String pic;

	@ApiModelProperty(value = "卡券链接地址")
	@TableField
	private String linkUrl;

	@ApiModelProperty(value = "卡券面值，单位分")
	@TableField
	private String faceValue;

	@ApiModelProperty(value = "过期类型，1.固定有效期,2 相对申领时间延后")
	@TableField
	private String expireType;

	@ApiModelProperty(value = "固定有效期开始时间，过期类型为1时必填，格式yyyy-MM-dd hh:mm:ss")
	@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
	@TableField
	private LocalDateTime startTime;

	@ApiModelProperty(value = "固定有效期过期时间，过期类型为1时必填，格式yyyy-MM-dd hh:mm:ss")
	@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
	@TableField
	private LocalDateTime expireTime;

	@JsonIgnore
	//@ApiModelProperty(value = "自申领成功后有效期天数，过期类型为2时必填，（天）")
	@TableField
	private Integer durationDay;

	@ApiModelProperty(value = "卡券状态，0 新建,1 有效,2 无效")
	@TableField
	private String state;

	@JsonIgnore
	//@ApiModelProperty(value = "总库存量")
	@TableField
	private Integer totalCount = 0;

	@JsonIgnore
	//@ApiModelProperty(value = "已生成卡券数量， 总库存量-已生成卡券数量=可申领卡券数量")
	@TableField
	private Integer usedCount = 0;

	@ApiModelProperty(value = "单次申领最大数")
	@TableField
	private Integer applyMaxNum = 0;

	@ApiModelProperty(value = "每人限购，-1不限购")
	@TableField
	private Integer buyMax = -1;

	@JsonIgnore
	//@ApiModelProperty(value = "售卖渠道,1数字生活")
	@TableField
	private String buyChannel;

	@ApiModelProperty(value = "售价（分）")
	@TableField
	private Integer price = 0;

	@JsonIgnore
	//@ApiModelProperty(value = "被未支付订单占用的库存数量（被锁定库存量）")
	@TableField
	private Integer unpaidCount = 0;

	@JsonIgnore
	//@ApiModelProperty(value = "1上架 2下架")
	@TableField
	private String shelve;

	@JsonIgnore
	//@ApiModelProperty(value = "是否同步获取申领结果 0同步  默认0")
	@TableField
	private String hasApplyNotify = "0";

	@ApiModelProperty(value = "是否允许退货，0允许 1不允许")
	@TableField
	private String hasRefund = "0";

	@JsonIgnore
	//@ApiModelProperty(value = "是否有核销通知，0通知 1不通知")
	@TableField
	private String hasUsedNotify;

	@ApiModelProperty(value = "品牌名称，连锁品牌时，卡券对应的品牌名称一致")
	@TableField
	private String brandName;

	@ApiModelProperty(value = "创建时间，格式yyyy-MM-dd hh:mm:ss")
	@TableField(fill = FieldFill.INSERT)
	private LocalDateTime createTime;

	@ApiModelProperty(value = "更新时间，格式yyyy-MM-dd hh:mm:ss")
	@TableField(fill = FieldFill.UPDATE)
	private LocalDateTime updateTime;

	@ApiModelProperty(value = "当前用户是否购买满了")
	@TableField(exist = false)
    private boolean isBuyFull;

}
